home *** CD-ROM | disk | FTP | other *** search
- #include <WM.h>
- #include <MS.h>
- #include <MyStructs.h>
-
- extern struct IntuiText RText[],AText[];
-
- USHORT RequestSource()
- {
- helpR=helpW->FirstRequest;
- if(CodeArt==0)
- {
- if(ExtraReq()) return(1);
- }
- if((Erlaubt & 8)==0)
- {
- if(CodeArt)
- {
- if(ExtraReq()) return(1);
- }
- return(0);
- }
- if(helpR->Type==1)
- {
- if(SysReqSource()) return(1);
- return(0);
- }
- if(helpR->Type==2)
- {
- if(AlertSource()) return(1);
- return(0);
- }
- RQ++;
- StrEnd=0;
- if(CodeArt==0) sprintf(Buffer,"%s%s ",STR,String[20]);
- MakeName(helpW->Title,RQ,20);
- if(CStart()) return(1);
- if(Null(1)) return(1);
- if(WindowPos()) return(1);
- if(Word(helpR->RelLeft,helpR->RelTop)) return(1);
- if(GadgetZeiger()) return(1);
- if(helpR->ReqImage==NULL)
- {
- if(helpR->ReqBorder)
- {
- AssT(2);
- KUnd();
- InLeer(9,GB);
- if(BuffKom()) return(1);
- }
- else if(Null(1)) return(1);
- if(TextZeiger(helpW->FirstText)) return(1);
- }
- else
- {
- if(Null(1)) return(1);
- if(Null(1)) return(1);
- }
- AssT(1);
- j=0;
- if(helpR->PFlags & POINTREL)
- {
- InBuff(RText[2].IText);
- j++;
- }
- if(helpR->PFlags & NOISYREQ)
- {
- Plus();
- InBuff(RText[3].IText);
- }
- if(helpR->ReqImage)
- {
- Plus();
- InBuff("PREDRAWN");
- }
- if(j==0) Nuller(0);
- if(KomTab()) return(1);
- AssT(0);
- sprintf(LEER,"%d",helpR->BackFill);
- BuffLeer();
- KommaNull(0);
- if(KomTab()) return(1);
- if(helpR->ReqImage)
- {
- if(Null(1)) return(1);
- if(CodeArt)
- {
- sprintf(LEER,"ds.b%s32",ZCode[1]);
- if(BuffKom()) return(1);
- }
- else
- {
- Nuller(15);
- StrEnd=1;
- if(KomTab()) return(1);
- StrEnd=0;
- Nuller(15);
- if(KomTab()) return(1);
- }
- AssT(2);
- i=BM;
- KUnd();
- if(CodeArt) i++;
- InLeer(21,i);
- BuffLeer();
- if(LSave()) return(1);
- }
- else if(Null(0)) return(1);
- if(CodeArt)
- {
- if(LSave()) return(1);
- if(ExtraReq()) return(1);
- }
- else
- {
- CEnde();
- if(DSave()) return(1);
- }
- return(0);
- }
-
- VOID InBuff(UBYTE *s)
- {
- strcat(Buffer,s);
- }
-
- VOID KommaNull(UBYTE mode)
- {
- if(CodeArt)
- {
- InBuff(",0");
- if(mode & 1) Tab();
- if(mode & 2) InBuff(AType[3]);
- }
- }
-
- USHORT WindowPos()
- {
- if(Word(helpW->LeftEdge,helpW->TopEdge)) return(1);
- if(Word(helpW->Width,helpW->Height)) return(1);
- return(0);
- }
-
- USHORT SysReqSource()
- {
- RSQ++;
- if(CodeArt)
- {
- if(ExtraReq()) return(1);
- }
- StrEnd=0;
- if(CodeArt) EquString(String[1],2); /* Window */
- else
- {
- InBuff(String[6]); /* define */
- MakeName(helpW->FirstGadget->Name,RSQ,24);
- InBuff(" ");
- }
- SetNull();
- Komma();
- if(CodeArt)
- {
- LineFeed();
- EquString(RqText6.IText,2);
- }
- if(BT==0) SetNull();
- else
- {
- KUnd();
- sprintf(LEER,"I%s%d",String[4],BT); /* BodyText */
- BuffLeer();
- }
- Komma();
- if(Save()) return(1);
- if(CodeArt)
- {
- LineFeed();
- EquString("PosText",2);
- }
- if(PT==0) SetNull();
- else
- {
- KUnd();
- sprintf(LEER,"I%s%d",String[4],PT); /* PositiveText */
- BuffLeer();
- }
- Komma();
- if(Save()) return(1);
- if(CodeArt)
- {
- LineFeed();
- EquString("NegText",2);
- }
- KUnd();
- sprintf(LEER,"I%s%d",String[4],NT); /* NegativeText */
- BuffLeer();
- Komma();
- if(Save()) return(1);
- if(CodeArt)
- {
- LineFeed();
- EquString("PosFlags",2);
- }
- j=0;
- if(helpR->PFlags)
- {
- for(i=0; i<23; i++)
- {
- if(helpR->PFlags & WIDCMP[i]) PIDCMP();
- }
- }
- if(j==0) SetNull();
- Komma();
- if(CodeArt)
- {
- LineFeed();
- EquString("NegFlags",2);
- }
- j=0;
- if(helpR->NFlags)
- {
- for(i=0; i<23; i++)
- {
- if(helpR->NFlags & WIDCMP[i]) PIDCMP();
- }
- }
- if(j==0) SetNull();
- Komma();
- if(CodeArt)
- {
- LineFeed();
- EquString("Width",1);
- }
- sprintf(LEER,"%d",awin->Width);
- BuffLeer();
- Komma();
- if(CodeArt)
- {
- LineFeed();
- EquString("Height",1);
- }
- sprintf(LEER,"%d",awin->Height);
- BuffLeer();
- StrEnd=1;
- if(DSave()) return(1);
- return(0);
- }
-
- VOID InLeer(UBYTE s,USHORT n)
- {
- sprintf(LEER,"%s%d",String[s],n);
- }
- VOID PIDCMP()
- {
- Plus();
- InBuff(WIDCMP1[i]);
- }
- VOID EquString(UBYTE *s,UBYTE type)
- {
- MakeName(helpW->FirstGadget->Name,RSQ,24);
- InBuff(s);
- InBuff(":");
- HTab();
- AssT(type);
- HTab();
- }
-
- USHORT AlertSource()
- {
- AL++;
- StrEnd=1;
- if(CodeArt==0) InBuff(CType[3]);
- MakeName(helpW->Title,AL,23);
- InBuff(String[4]);
- if(CodeArt==0) InBuff(" []");
- if(CStart()) return(1);
- AssT(0);
- helpT=helpW->FirstText;
- while(helpT)
- {
- sprintf(LEER,"%d,%d,%d",helpT->LeftEdge & 0xFF00,
- helpT->LeftEdge & 0x00FF,helpT->TopEdge);
- if(BuffKom()) return(1);
- PL=0;
- AssT(0);
- SetByte(helpT->IText);
- helpT=helpT->NextText;
- if(KomTab()) return(1);
- AssT(0);
- if(CodeArt)
- {
- Nuller(0);
- SetKomma();
- }
- if(helpT) InBuff("1,");
- else Nuller(0);
- if(Save()) return(1);
- }
- LineFeed();
- if(CodeArt==0) CEnde();
- else
- {
- HTab();
- AssT(3);
- }
- DoubleFeed();
- if(CodeArt==0) InBuff(String[6]);
- MakeName(helpW->Title,AL,23);
- if(CodeArt)
- {
- InBuff("Flag:");
- HTab();
- AssT(2);
- }
- else InBuff(" ");
- if(helpR->PFlags) InBuff(AText[2].IText);
- else InBuff(AText[1].IText);
- if(CodeArt) LineFeed();
- else SetKomma();
- MakeName(helpW->Title,AL,23);
- if(CodeArt)
- {
- InBuff("Height:");
- HTab();
- AssT(1);
- }
- else
- {
- InBuff(String[4]);
- SetKomma();
- }
- sprintf(LEER,"%d",helpW->Height);
- BuffLeer();
- if(DSave()) return(1);
- return(0);
- }
-
- VOID SetKomma()
- {
- InBuff(",");
- }
-
- VOID SetByte(UBYTE *s)
- {
- UBYTE z=2;
- if(CodeArt) z++;
- InBuff(ZCode[z]);
- InBuff(s);
- InBuff(ZCode[z]);
- }
-
- USHORT BuffKom()
- {
- BuffLeer();
- if(KomTab()) return(1);
- return(0);
- }
-
- USHORT ExtraReq()
- {
- if(helpR->Type==1)
- {
- helpG=helpW->FirstGadget;
- if(CodeArt) NT=TX+1;
- if(TextSource(helpG->FirstText,0)==1) return(1);
- if(CodeArt==0) NT=TX;
- PT=0;
- if(helpG->NextGadget->PFlags)
- {
- if(CodeArt) PT=TX+1;
- if(TextSource(helpG->NextGadget->FirstText,0)==1)
- return(1);
- if(CodeArt==0) PT=TX;
- }
- }
- BT=0;
- if(helpW->FirstText && helpR->Type < 2)
- {
- if(helpR->ReqImage==NULL)
- {
- TXL++;
- i=1;
- if(helpR->Type==1) i--;
- if(CodeArt) BT=TX+1;
- if(TextSource(helpW->FirstText,i)==1) return(1);
- if(CodeArt==0)
- {
- BT=TX;
- sprintf(Buffer,"%s%s%s%d I%s%d",String[6],
- String[4],String[5],TXL,String[4],TX);
- if(DSave()) return(1);
- }
- }
- }
- if(helpW->FirstGadget && helpR->Type==0)
- {
- helpG=helpW->FirstGadget;
- if(GadgetSource()) return(1);
- }
- if(helpR->ReqBorder != NULL && helpR->ReqImage==NULL)
- {
- BType=2;
- if(BorderSource(0)) return(1);
- GB=BO;
- }
- if(helpR->ReqImage)
- {
- if(BitMapSource()) return(1);
- }
- return(0);
- }
-
- USHORT BitMapSource()
- {
- BM++;
- helpI=helpR->ReqImage;
- if(CodeArt==0)
- {
- if(DataSource(1)) return(1);
- sprintf(Buffer,"%s%s ",STR,String[21]);
- }
- InLeer(21,BM);
- BuffLeer();
- StrEnd=0;
- if(CStart()) return(1);
- Iffx=((helpI->Width+15) >> 4) << 1;
- if(Word(Iffx,helpI->Height)) return(1);
- if(Byte(0,helpI->Depth)) return(1);
- AssT(1);
- Nuller(0);
- StrEnd=1;
- if(KomTab()) return(1);
- StrEnd=0;
- for(PL=0; PL < helpI->Depth; PL++)
- {
- AssT(2);
- if(CodeArt==0) InBuff("(PLANEPTR)");
- sprintf(LEER,"%s%d%s%d",String[21],BM,String[22],PL+1);
- BuffLeer();
- if((PL+1) != helpI->Depth)
- {
- if(KomTab()) return(1);
- }
- }
- if(CodeArt==0)
- {
- LineFeed();
- CEnde();
- }
- if(DSave()) return(1);
- if(CodeArt) if(DataSource(1)) return(1);
- return(0);
- }
-
- VOID Nuller(UBYTE anzahl)
- {
- while(anzahl)
- {
- InBuff("0,");
- anzahl--;
- }
- InBuff("0");
- }
-
- USHORT TextZeiger(struct MyText *text)
- {
- if(text)
- {
- AssT(2);
- i=TX;
- KUnd();
- if(CodeArt) i++;
- sprintf(LEER,"I%s%d",String[4],i);
- if(BuffKom()) return(1);
- }
- else if(Null(1)) return(1);
- return(0);
- }
-
- USHORT GadgetZeiger()
- {
- if(helpW->FirstGadget && (Erlaubt & 32))
- {
- helpG=helpW->FirstGadget;
- while(helpG->Border==2 || helpG->Image==2)
- helpG=helpG->NextGadget;
- if(helpG)
- {
- AssT(2);
- KUnd();
- if(strlen(helpG->Name))
- InBuff(helpG->Name);
- else
- {
- i=GD;
- if(CodeArt) i++;
- InLeer(8,i);
- BuffLeer();
- }
- if(KomTab()) return(1);
- }
- else if(Null(1)) return(1);
- }
- else if(Null(1)) return(1);
- return(0);
- }
-
- VOID WinBorder(struct Window *w)
- {
- WV1[2]=w->Width-11;
- WV1[4]=w->Width-11;
- WV1[5]=w->Height-5;
- WV1[7]=w->Height-5;
- WV2[2]=w->Width-9;
- WV2[4]=w->Width-9;
- WV2[5]=w->Height-5;
- WV2[7]=w->Height-5;
- WV3[2]=w->Width-7;
- WV3[4]=w->Width-7;
- WV3[5]=w->Height-3;
- WV3[7]=w->Height-3;
- WV4[2]=w->Width-5;
- WV4[4]=w->Width-5;
- WV4[5]=w->Height-3;
- WV4[7]=w->Height-3;
- WV5[2]=w->Width-3;
- WV5[4]=w->Width-3;
- WV5[5]=w->Height-1;
- WV5[7]=w->Height-1;
- WV6[2]=w->Width-1;
- WV6[4]=w->Width-1;
- WV6[5]=w->Height-1;
- WV6[7]=w->Height-1;
- DrawBorder(w->RPort,&WB[5],0,0);
- }
-
- USHORT TestReqImage(struct MyWindow *w)
- {
- if(w->FirstRequest == NULL || (w->FirstRequest != NULL &&
- w->FirstRequest->ReqImage==NULL)) return(1);
- return(0);
- }